#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <linux/limits.h>
#include "rocerror.h"  // 添加错误处理库头文件

int main(int argc, char *argv[]) {
    char filename[PATH_MAX] = { 0 };

    // 检查参数错误，使用 app_error
    if (argc != 2) {
        app_error("You must supply a filename as an argument");
    }

    strncpy(filename, argv[1], sizeof(filename) - 1);
    filename[sizeof(filename) - 1] = '\0';

    // 替换原有的错误处理为 unix_error
    if (creat(filename, 0644) == -1) {
        unix_error("Can't create file");
    }

    return 0;
}